var ScrambledEggs;
(function (ScrambledEggs) {
    (function (Modules) {
        var StatusDisplay = (function () {
            function StatusDisplay() {
                this._maxPhysique = 500;
                this._maxIntelligence = 500;
            }
            StatusDisplay.prototype.initialize = function (gameState, onUpdate) {
                this._onUpdate = onUpdate;
            };
            StatusDisplay.prototype.update = function (gameState, triggerSource) {
                if(gameState.State.Phase == ScrambledEggs.GamePhase.Fetus) {
                    $("#status").hide();
                    return;
                }
                $("#primary").show();
                var status = $("#status").show();
                var state = gameState.State;
                status.children("div").hide();
                status.find(".name").html(state.Name);
                switch(state.Phase) {
                    case ScrambledEggs.GamePhase.Baby:
                        status.find(".baby").show();
                        var intPct = Math.min(100, Math.floor(state.MentalMaturity / this._maxIntelligence * 1000) / 10);
                        var physPct = Math.min(100, Math.floor(state.PhysicalMaturity / this._maxPhysique * 1000) / 10);
                        status.find(".mental").find(".progress").css("width", intPct + "%");
                        status.find(".physical").find(".progress").css("width", physPct + "%");
                        status.find(".fullness").toggle(state.Fullness >= 0).find(".progress").css("width", Math.floor(state.Fullness * 10) / 10 + "%");
                        break;
                    case ScrambledEggs.GamePhase.YoungAdult:
                        status.find(".youngadult").show();
                        status.find(".intelligence").toggle(state.Intelligence > -1).find(".value").html(state.Intelligence);
                        status.find(".popularity").toggle(state.Popularity > -1).find(".value").html(state.Popularity);
                        status.find(".time").toggle(state.Time > -1).find(".value").html(state.Time);
                        status.find(".money").toggle(state.Money > -1).find(".value").html(state.Money);
                        status.find(".job").toggle(state.PartTimeJob != ScrambledEggs.PartTimeJob.None).find(".value").html(ScrambledEggs.Utility.Text.FromJob(state.PartTimeJob, state.Gender));
                        status.find(".energy").find(".progress").css("width", state.Energy + "%");
                        break;
                }
            };
            return StatusDisplay;
        })();
        Modules.StatusDisplay = StatusDisplay;        
    })(ScrambledEggs.Modules || (ScrambledEggs.Modules = {}));
    var Modules = ScrambledEggs.Modules;
})(ScrambledEggs || (ScrambledEggs = {}));
